<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>demo1</title>
	<style type="text/css">
	    body{
	    	background-color: #808080;
	    }
        #father{
        	width: 300px;
        	height: 20px;
            background-color: #E6E6E6;
            position: absolute;
            top:250px;
            left: 300px;
            border-radius: 10px; 
            overflow: hidden;
        }
        #son{
        	width: 300px;
        	height: 20px;
        	background-color: #FFA280;
        	border-radius: 10px;
        	position: absolute;
        	left: -300px;
        }
	</style>
</head>
<body onload="run()">
	 <div id="father">
	 	<div id="son"></div>
	 </div>
</body>
<script type="text/javascript">
    var son = parseInt(document.getElementById('son').offsetLeft);
	function run (){
       son++;
       document.getElementById('son').style.left = son+"px";
       if(son>=0){
          clearInterval(time1);
       }
	}
	var time1 = setInterval(run,10)
</script>
</html>